﻿<UserControl x:Class="ICSharpCode.Data.SQLServer.ControlPanel.SQLServerControlPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:core="http://icsharpcode.net/sharpdevelop/core"
    x:Name="This">
    <UserControl.Resources>
        <ResourceDictionary>
            <core:NotBoolConverter x:Key="OppositeBoolConverter" />
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <TextBlock Margin="2">User Id:</TextBlock>
        <TextBox Grid.Column="1" Margin="2" Text="{Binding Datasource.UserId, ElementName=This}"
            IsEnabled="{Binding IsChecked, ElementName=chkIntegratedSecurity, Converter={StaticResource OppositeBoolConverter}}" />
        <TextBlock Grid.Row="1" Margin="2">Password:</TextBlock>
        <PasswordBox Grid.Row="1" Grid.Column="1" Margin="2" PasswordChanged="PasswordBox_PasswordChanged"
            IsEnabled="{Binding IsChecked, ElementName=chkIntegratedSecurity, Converter={StaticResource OppositeBoolConverter}}" />
        
        <CheckBox x:Name="chkIntegratedSecurity" Grid.Row="2" Grid.Column="1" IsChecked="{Binding Datasource.IntegratedSecurity, ElementName=This}">Integrated Security</CheckBox>
    </Grid>
</UserControl>
